package oving5.card;

public class CardDeck {
	Card[] cards;
	int cardCount;
	public CardDeck(){
		String[] a={"S","H","D","C"};
		int stokklengde=52;
		cards=new Card[stokklengde];
		cardCount=0;
		for(int i=0;i<a.length;i++){
			for(int j=0;j<stokklengde/4;j++){
				cards[cardCount]=new Card(a[i],j+1);
				cardCount++;
			}
			
		}
	}
	public int getCardCount(){
		return cardCount;
	}
	
	public Card getCard(int arg){
		if(arg>=0&&arg<cardCount){
			return cards[arg];
		}
		return null;
	}
	public Card[] deal(int a){
		if(a<=cardCount){
			Card[] c= new Card[a];
			for(int i =0;i<a;i++ ){
				c[i]=cards[cardCount-i-1];
			}
			cardCount-=a;
			return c;
		}
		else{
			return null;
		}
	}
	public void main(String[] args){
		
			
	}
}
